home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 September (IDG) / Sep99.iso / Shareware World / Comms & Internet / LinkConverter 1.1.2 / Dialog Director v0.7 / Examples / Check List.as < prev    next >
Encoding:
Text File  |  1998-01-12  |  1.6 KB  |  46 lines  |  [TEXT/ToyS]

  1. set aList to [¬
  2.     "    Last Name", "    Middle Name", "    First Name", ¬
  3.     "    Personal Title", "    Business Name", "    Business Street", ¬
  4.     "    Business City", "    Business County", "    Business Postal Code", ¬
  5.     "    Business Title", "    Home Street", "    Home City", "    Home County", ¬
  6.     "    Home Postal Code", "    Notes", "    Phone Type", "    Phone Number", ¬
  7.     "    EMail Address", "    Country"]
  8.  
  9. set listDialog to {size:[280, 166], name:"Check List", style:movable dialog, contents:[¬
  10.     {class:push button, name:"OK", bounds:[210, 136, 270, 156], enabled:false}, ¬
  11.     {class:push button, name:"Cancel", bounds:[210, 104, 270, 124]}, ¬
  12.     {class:list box, contents:aList, bounds:[10, 26, 190, 156], column widths:[15, 200], action:99}, ¬
  13.     {class:static text, contents:"Double click some items:", bounds:[8, 4, 270, 20]} ¬
  14.         ]}
  15.  
  16. dd install with grayscale
  17. set d to dd make dialog listDialog
  18. set checkCount to 0
  19. repeat
  20.     set i to dd interact with user
  21.     if i = 99 then -- Double clicked list
  22.         set x to dd get value of item 3 of d
  23.         set s to item x of aList
  24.         if character 1 of s = tab then
  25.             set item x of aList to "" & s
  26.             set checkCount to checkCount + 1
  27.         else
  28.             set item x of aList to text 2 thru -1 of s
  29.             set checkCount to checkCount - 1
  30.         end if
  31.         dd set contents of item 3 of d to aList
  32.         dd set value of item 3 of d to x
  33.         dd set enabled of item 1 of d to (checkCount ≠ 0)
  34.     else if i = 1 or i = 2 then
  35.         exit repeat
  36.     end if
  37. end repeat
  38. dd uninstall
  39.  
  40. if i = 1 then
  41.     set checkList to []
  42.     repeat with i from 1 to aList's length
  43.         if aList's item i's character 1 ≠ tab then set checkList to checkList & i
  44.     end repeat
  45.     return checkList
  46. end if